package com.github.kotvertolet.youtubejextractor.models.newModels;

import com.google.gson.annotations.SerializedName;
import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

import java.io.Serializable;

public class WebCommandMetadata implements Sequenceable, Serializable {
    @SerializedName("apiUrl")
    private String apiUrl;

    @SerializedName("rootVe")
    private int rootVe;

    @SerializedName("webPageType")
    private String webPageType;

    @SerializedName("url")
    private String url;

    @SerializedName("sendPost")
    private boolean isSendPost;


    public static final Sequenceable.Producer<WebCommandMetadata> CREATOR = new Producer<WebCommandMetadata>() {
        @Override
        public WebCommandMetadata createFromParcel(Parcel parcel) {
            // Initialize an instance first, then do customized unmarshlling.
            WebCommandMetadata webCommandMetadata = new WebCommandMetadata();
            webCommandMetadata.unmarshalling(parcel);
            return webCommandMetadata;
        }
    };

    @Override
    public boolean marshalling(Parcel parcel) {
        parcel.writeString(this.apiUrl);
        parcel.writeInt(this.rootVe);
        parcel.writeString(this.webPageType);
        parcel.writeString(this.url);
        parcel.writeBoolean(this.isSendPost);
        return true;
    }

    @Override
    public boolean unmarshalling(Parcel parcel) {
        this.apiUrl = parcel.readString();
        this.rootVe = parcel.readInt();
        this.webPageType = parcel.readString();
        this.url = parcel.readString();
        this.isSendPost = parcel.readBoolean();
        return true;
    }

    public String getApiUrl() {
        return apiUrl;
    }

    public void setApiUrl(String apiUrl) {
        this.apiUrl = apiUrl;
    }

    public int getRootVe() {
        return rootVe;
    }

    public void setRootVe(int rootVe) {
        this.rootVe = rootVe;
    }

    public String getWebPageType() {
        return webPageType;
    }

    public void setWebPageType(String webPageType) {
        this.webPageType = webPageType;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public boolean isSendPost() {
        return isSendPost;
    }

    public void setSendPost(boolean sendPost) {
        isSendPost = sendPost;
    }

    @Override
    public String toString() {
        return "WebCommandMetadata{" +
                "apiUrl='" + apiUrl + '\'' +
                ", rootVe=" + rootVe +
                ", webPageType='" + webPageType + '\'' +
                ", url='" + url + '\'' +
                ", isSendPost=" + isSendPost +
                '}';
    }
}
